package com.blockmeta.bbs.immodule.widget;

import android.content.Context;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.blockmeta.bbs.immodule.R;


/**
 * im通用弹窗布局
 */
public abstract class IMSysPopup extends IMPopup {
    protected TextView m_tvTitle, m_tvMsg;
    protected TextView m_btnCancel, m_btnAction;
    protected EditText m_editMsg;
    protected View m_vSeparated;

    public IMSysPopup(Context pContext) {
        super(pContext, R.layout.im_popup_sys);
    }

    @Override
    protected final void initView(View pView) {
        m_tvTitle = (TextView) pView.findViewById(R.id.im_popup_sys_tv_title);
        m_btnCancel = (TextView) pView.findViewById(R.id.im_popup_sys_btn_cancel);
        m_btnAction = (TextView) pView.findViewById(R.id.im_popup_sys_btn_action);
        m_editMsg = (EditText) pView.findViewById(R.id.im_popup_sys_edit);
        m_tvMsg = (TextView) pView.findViewById(R.id.im_popup_sys_msg);

        m_btnCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onCancelClick();
                dismissDialog();
            }
        });

        m_btnAction.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onActionClick();
            }
        });

        initializeView(pView);
    }

    protected abstract void initializeView(View pView);

    protected abstract void onActionClick();

    protected void onCancelClick() {
    }
}
